﻿using System;

namespace Lightray.Hattrick.ChppLib.EntityTypes
{
    public abstract class BasicPlayer : EntityBase
    {
        #region Properties

        public string FirstName { get; protected set; }
        public string LastName { get; protected set; }
        public string Name
        {
            get
            {
                return string.Format("{0} {1}", FirstName, LastName);
            }
        }
        public HattrickAge Age { get; protected set; }

        public Specialty Specialty { get; protected set; }
        public int Cards { get; protected set; }
        public int InjuryLevel { get; protected set; }

        public SkillLevel Keeper { get; protected set; }
        public SkillLevel Playmaking { get; protected set; }
        public SkillLevel Scoring { get; protected set; }
        public SkillLevel Passing { get; protected set; }
        public SkillLevel Winger { get; protected set; }
        public SkillLevel Defending { get; protected set; }
        public SkillLevel SetPieces { get; protected set; }

        public int LeagueGoals { get; protected set; }
        public int CareerGoals { get; protected set; }
        public int CareerHattricks { get; protected set; }
        public PlayerMatchStats LastMatch { get; protected set; }        

        public Team Team { get; internal set; }
        protected internal int TeamID { get; protected set; }

        #endregion            

        public static int GetSkillValue(SkillLevel skill)
        {
            return (int)skill;
        }

        public virtual SkillLevel GetSkillLevel(Skill skill)
        {
            switch (skill)
            {               
                case Skill.Keeper:
                    return Keeper;
                case Skill.Playmaking:
                    return Playmaking;
                case Skill.Scoring:
                    return Scoring;
                case Skill.Passing:
                    return Passing;
                case Skill.Winger:
                    return Winger;
                case Skill.Defending:
                    return Defending;
                case Skill.SetPieces:
                    return SetPieces;
            }
            return SkillLevel.NonExistent;
        }

        public override string ToString()
        {
            return Name;
        }
    }
}
